package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 巡更分析
 *
 * @author ytche
 * @date 2017年8月22日
 *
 */
@Entity
@Table(name = "person_location_analysis")
@JsonApiResource(type = "personLocationAnalysis")
public class PersonLocationAnalysis extends BaseEntity {
	private static final long serialVersionUID = 1L;

	private Employee employee;
	private PersonLocationIoReport location;
	private Integer completeStatus;// 是否完成 0否1是
	private Dicttype type; // 类型locatinAnalysisType
	private Integer startTime;
	private Integer endTime;

	// private CustomerDrugProjectItem drugProItem;// 用药计划
	// private NursingPlanDetail planItem;// 定时任务
	// private NursingProjectServiceItem nurSingProItem;// 非定时任务
	private CustomerDrugProjectExe drugExe;// 用药执行
	private NursingPlanExecute planItemExe;// 定时任务执行

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiIncludeByDefault
	@JsonApiToOne
	@JoinColumn(name = "employee_id")
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "location_id")
	public PersonLocationIoReport getLocation() {
		return location;
	}

	public void setLocation(PersonLocationIoReport location) {
		this.location = location;
	}

	@Column(name = "complete_status")
	public Integer getCompleteStatus() {
		return completeStatus;
	}

	public void setCompleteStatus(Integer completeStatus) {
		this.completeStatus = completeStatus;
	}

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	public Dicttype getType() {
		return type;
	}

	public void setType(Dicttype type) {
		this.type = type;
	}

	@Column(name = "start_time")
	public Integer getStartTime() {
		return startTime;
	}

	public void setStartTime(Integer startTime) {
		this.startTime = startTime;
	}

	@Column(name = "end_time")
	public Integer getEndTime() {
		return endTime;
	}

	public void setEndTime(Integer endTime) {
		this.endTime = endTime;
	}

	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "drug_exe_id")
	public CustomerDrugProjectExe getDrugExe() {
		return drugExe;
	}

	public void setDrugExe(CustomerDrugProjectExe drugExe) {
		this.drugExe = drugExe;
	}

	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "plan_item_exe_id")
	public NursingPlanExecute getPlanItemExe() {
		return planItemExe;
	}

	public void setPlanItemExe(NursingPlanExecute planItemExe) {
		this.planItemExe = planItemExe;
	}

	// @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	// @Fetch(FetchMode.JOIN)
	// @JsonApiToOne
	// @JsonApiIncludeByDefault
	// @JoinColumn(name = "plan_item_id")
	// public NursingPlanDetail getPlanItem() {
	// return planItem;
	// }
	//
	// public void setPlanItem(NursingPlanDetail planItem) {
	// this.planItem = planItem;
	// }
	//
	// @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	// @Fetch(FetchMode.JOIN)
	// @JsonApiToOne
	// @JsonApiIncludeByDefault
	// @JoinColumn(name = "nurSing_pro_item_id")
	// public NursingProjectServiceItem getNurSingProItem() {
	// return nurSingProItem;
	// }
	//
	// public void setNurSingProItem(NursingProjectServiceItem nurSingProItem) {
	// this.nurSingProItem = nurSingProItem;
	// }

}
